package com.wn.ticket.web.backstage;

import com.wn.ticket.common.PageBean;
import com.wn.ticket.common.ResponseEntity;
import com.wn.ticket.entity.Order;
import com.wn.ticket.service.OrderService;
import com.wn.ticket.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wuqingting
 * @date 2022/9/6
 */
@RestController
@RequestMapping("/backstage/order")
public class BackstageOrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("/getPage")
    public ResponseEntity getPage(@RequestBody OrderVo orderVo){
        PageBean<Order> pageBean = orderService.getByCondition(orderVo);

        return new ResponseEntity(pageBean);
    }

    @RequestMapping("/getById/{id}")
    public ResponseEntity getById(@PathVariable int id){
        Order order = orderService.getOrderById(id);

        return new ResponseEntity(order);
    }
}
